Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add entering normal mode as autosave trigger #6563

Closed
wants to merge 6 commits into from

Conversation

TobTobXX
Copy link
Contributor

@TobTobXX TobTobXX commented Apr 2, 2023

For me, autosave is an essential feature. But the 'unfocus' trigger doesn't work, since autosave also triggrers reformatting (which I think is useful), but causes a massive loss of context when triggered on unfocus. (I'd switch workspaces to copy some code and bam! autoformat moved my cursor around when I look back...)

However, when exiting edit mode, it's quite natural, as I've finished doing my edit, I actually want the formatter to clean it up. It is also a rather logical time to autosave, since I've just made an edit.

TODOs

See also:

@TobTobXX
Copy link
Contributor Author

TobTobXX commented Apr 2, 2023

Note, that the last TODO (updating statusline) doesn't work with the unfocus trigger either. *shrug

@TobTobXX TobTobXX marked this pull request as draft April 2, 2023 23:40
@TobTobXX
Copy link
Contributor Author

TobTobXX commented Apr 3, 2023

Ugh, thanks to this stupid comment the config is now quite a bit uglier and more indirect.

btw, can we ignore clippy on helix-view/src/editor.rs:1699:9? That hint, while technically correct, is really NOT helping readability.

@archseer
Copy link
Member

archseer commented Apr 3, 2023

Do we really need another config option? We could just trigger on both

\cc @groves

@pascalkuthe
Copy link
Member

pascalkuthe commented Apr 3, 2023

I am not sure this even needs to be build in. I have just bound esc to [normal_mode, :w<ret>] works well enough for saving on exting insert modem It doesn't quite catch all instances of exiting normal mode but it's good enough for the most part.

I think in the long run we would want something more flexible to save (after a decently long denounced timeout) after every edit so doing edits in normal.mode (replace, paste, rename) also triggers autosave. Until such a solution is.implemented I think the keybindkng above is a good enough workaround

@TobTobXX
Copy link
Contributor Author

TobTobXX commented Apr 3, 2023

Ok, I'll yield. Your point is valid.

@TobTobXX TobTobXX closed this Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants